<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8559-1">
<TITLE>toursdb_readme.htm</TITLE>
<link rel="stylesheet" type="text/css" href="../csfull.css" title="toursdb">
</HEAD>
<BODY>

<META name="CREATED" content="20051031;9095275">
<META name="CHANGED" content="20051031;9274086">

<H1>
<A NAME="top"></A>Derby Example and Demo Database toursdb</FONT></H1>
<H2><FONT SIZE="5">1. Introduction</FONT></H2>
<P> This document describes some aspects of the Derby Example and demo database toursdb. 
<H2><FONT SIZE="5">2. Purpose of the database toursdb</FONT></H2>
<P>The toursdb is provided as an example and demo database to illustrate some functionality of the Derby RDBMS. Many of the examples in the Derby documentation use tables that exist in the toursdb database. 
<P>The toursdb database is created, and can be recreated using the files in &lt;your derby install directory&gt;/demo/programs if you have an installation that includes these. 
<P>The built database is placed in &lt;your derby install directory&gt;/demo/databases. 
<H2><FONT SIZE="5">3. The toursdb schema</FONT></H2>
<P>The toursdb schema is the default schema, 'APP'. 
<P>The toursdb tables are: 
<BR>(Note: in the following table no description is given where the columnname is deemed to be explanation enough.) <BR CLEAR="LEFT">
<A HREF="#AIRLINES">AIRLINES</A> <BR CLEAR="LEFT">
<A HREF="#COUNTRIES">COUNTRIES</A> <BR CLEAR="LEFT">
<A HREF="#CITIES">CITIES</A> <BR CLEAR="LEFT">
<A HREF="#FLIGHTS">FLIGHTS</A> <BR CLEAR="LEFT">
<A HREF="#FLIGHTAVAILABILITY">FLIGHTAVAILABILITY</A> <BR CLEAR="LEFT">
<A HREF="#MAPS">MAPS</A> <BR CLEAR="LEFT">
<A HREF="#FLIGHTS_HISTORY">FLIGHTS_HISTORY</A> 
<P>Constraints and Indices are listed underneath the respective tables 
<P><A HREF="#TRIGGERS">TRIGGERS</A> 
<P>
<TABLE BORDER="1" BORDERCOLOR="#000000" CELLSPACING="0" CELLPADDING="4" WIDTH="100%">
	<TR>
		<TD WIDTH="19%" ALIGN="LEFT" VALIGN="TOP">TableName  </TD>
		<TD WIDTH="30%" ALIGN="LEFT" VALIGN="TOP">ColumnName  </TD>
		<TD WIDTH="22%" ALIGN="LEFT" VALIGN="TOP">DataType  </TD>
		<TD WIDTH="6%" ALIGN="LEFT" VALIGN="TOP">other  </TD>
		<TD WIDTH="19%" ALIGN="LEFT" VALIGN="TOP">Description  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="TOP"><A NAME="AIRLINES"></A>AIRLINES   </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Information about Airline companies  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">AIRLINE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(2)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Airline company code  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">AIRLINE_FULL  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(24)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Full name of Airline company  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">BASIC_RATE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DOUBLE_PRECISION  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Basic rate for flying with this airline  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="TOP">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DISTANCE_DISCOUNT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DOUBLE PRECISION  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Discount for larger distances  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="TOP">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">BUSINESS_LEVEL_FACTOR  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DOUBLE PRECISION  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="TOP">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FIRSTCLASS_LEVEL_FACTOR  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DOUBLE PRECISION  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Percentage addition for first class cost  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="TOP">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">ECONOMY_SEATS  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">No. of economy seats  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="TOP">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">BUSINESS_SEATS  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">No. of business seats  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FIRSTCLASS_SEATS  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">No. of first class seats  </TD></TR>

</TABLE>

<P>CONSTRAINTS: <BR CLEAR="LEFT">


<UL>constraint AIRLINES_PK AIRLINE Primary Key </UL>

<P>
<TABLE BORDER="1" BORDERCOLOR="#000000" CELLSPACING="0" CELLPADDING="4" WIDTH="100%">
	<TR>
		<TD WIDTH="19%" ALIGN="LEFT" VALIGN="TOP"><A NAME="COUNTRIES"></A>COUNTRIES  </TD>
		<TD WIDTH="31%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="22%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="6%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="19%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">COUNTRY  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(26)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Country name in English  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">COUNTRY_ISO_CODE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(2)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Country code  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">REGION  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(26)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Region  </TD></TR>

</TABLE>

<P>CONSTRAINTS: <BR CLEAR="LEFT">


<UL>constraint COUNTRIES_PK COUNTRY_ISO_CODE Primary Key <BR CLEAR="LEFT">
constraint COUNTRIES_UNQ_NM Unique Country <BR CLEAR="LEFT">
constraint COUNTRIES_UC Check country_ISO_code = upper(country_ISO_code) </UL>

<P>
<TABLE BORDER="1" BORDERCOLOR="#000000" CELLSPACING="0" CELLPADDING="4" WIDTH="100%">
	<TR>
		<TD WIDTH="20%" ALIGN="LEFT" VALIGN="TOP"><A NAME="CITIES"></A>CITIES  </TD>
		<TD WIDTH="32%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="23%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="6%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="16%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CITY_ID &nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CITY_NAME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(24)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">COUNTRY  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(26)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">AIRPORT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(3)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">airport code&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">LANGUAGE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(16)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">COUNTRY_ISO_CODE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(2)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FK  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

</TABLE>

<P>CONSTRAINTS: <BR CLEAR="LEFT">


<UL>constraint CITIES_PK CITY_ID Primary Key <BR CLEAR="LEFT">
constraint COUNTRIES_FK Foreign Key COUNTRY_ISO_CODE references <BR CLEAR="LEFT">
</UL>


<UL><UL><UL>COUNTRIES.COUNTRY_ISO_CODE</UL></UL></UL>

<P>
<TABLE BORDER="1" BORDERCOLOR="#000000" CELLSPACING="0" CELLPADDING="4" WIDTH="100%">
	<TR>
		<TD WIDTH="19%" ALIGN="LEFT" VALIGN="TOP"><A NAME="FLIGHTS"></A>FLIGHTS  </TD>
		<TD WIDTH="31%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="22%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="6%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="19%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FLIGHT_ID  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(6)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">SEGMENT_NUMBER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">number for segment of a flight  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">ORIG_AIRPORT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(3)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">airport where flight originates  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DEPART_TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">scheduled departure time  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DEST_AIRPORT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(3)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">destination airport  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">ARRIVE_TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">scheduled arrival time  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">MEAL  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(1)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">indicator for type of meals available<BR CLEAR="LEFT">
B - Breakfast<BR CLEAR="LEFT">
L - Lunch<BR CLEAR="LEFT">
D - Dinner<BR CLEAR="LEFT">
S - Snack  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FLYING_TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DOUBLE PRECISION  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">scheduled duration of flight  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">MILES  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">length of flight  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">AIRCRAFT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(6)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">type of aircraft  </TD></TR>

</TABLE>

<P>CONSTRAINTS: <BR CLEAR="LEFT">


<UL>constraint FLIGHTS_PK FLIGHT_ID,SEGMENT_NUMBER Primary Key <BR CLEAR="LEFT">
constraint MEAL_COUNSTRAINT Check meal IN ('B', 'L', 'D', 'S') </UL>

<P>INDICES: <BR CLEAR="LEFT">


<UL>index DESTINDEX on FLIGHTS (DEST_AIRPORT) <BR CLEAR="LEFT">
index ORIGINDEX on FLIGHTS (ORIG_AIRPORT) </UL>

<P>
<TABLE BORDER="1" BORDERCOLOR="#000000" CELLSPACING="0" CELLPADDING="4" WIDTH="100%">
	<TR>
		<TD WIDTH="20%" ALIGN="LEFT" VALIGN="TOP"><A NAME="FLIGHTAVAILABILITY"></A>FLIGHTAVAILABILITY  </TD>
		<TD WIDTH="31%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="23%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="6%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="18%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FLIGHT_ID  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(6)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">SEGMENT_NUMBER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">number for segment of a flight</TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FLIGHT_DATE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DATE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PK, not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">date on which the flight takes place&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">ECONOMY_SEATS_TAKEN  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">def. 0  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">BUSINESS_SEATS_TAKEN  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">def. 0  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FIRSTCLASS_SEATS_TAKEN  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">def. 0  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

</TABLE>

<P>def. = default 
<P>CONSTRAINTS: <BR CLEAR="LEFT">


<UL>constraint FLIGHT_AVAILABILITY_PK FLIGHT_ID, SEGMENT_NUMBER, FLIGHT_DATE Primary Key <BR CLEAR="LEFT">
constraint FLIGHTS_FK2 Foreign Key FLIGHT_ID,SEGMENT_NUMBER references </UL>


<UL><UL><UL>FLIGHTS. FLIGHT_ID, SEGMENT_NUMBER</UL></UL></UL>

<P>
<TABLE BORDER="1" BORDERCOLOR="#000000" CELLSPACING="0" CELLPADDING="4" WIDTH="100%">
	<TR>
		<TD WIDTH="20%" ALIGN="LEFT" VALIGN="TOP"><A NAME="MAPS"></A>MAPS  </TD>
		<TD WIDTH="31%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="23%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="6%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="18%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">MAP_ID  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null, <P>gen. alw. as id. st. 1 incr. by 1  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">MAP_NAME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(24)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">REGION  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(26)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">AREA DECIMAL(8,4)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PHOTO_FORMAT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(26)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">PICTURE  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">BLOB(102400)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

</TABLE>

<P>gen alw. as id. st. 1 incr. by 1 = generated always as identity (start with 1, increment by 1) 
<P>CONSTRAINTS: <BR CLEAR="LEFT">


<UL>constraint Unique MAP_ID, MAP_NAME </UL>

<P>
<TABLE BORDER="1" BORDERCOLOR="#000000" CELLSPACING="0" CELLPADDING="4" WIDTH="100%">
	<TR>
		<TD WIDTH="20%" ALIGN="LEFT" VALIGN="TOP"><A NAME="FLIGHTS_HISTORY"></A>FLIGHTS_HISTORY  </TD>
		<TD WIDTH="30%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="22%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="6%" ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD WIDTH="18%" ALIGN="LEFT" VALIGN="TOP">archived flights  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FLIGHT_ID  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(6)  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">SEGMENT_NUMBER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">not null  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">number for segment of a flight  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">ORIG_AIRPORT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(3)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">airport where flight originates  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DEPART_TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">scheduled departure time  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DEST_AIRPORT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(3)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">destination airport  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">ARRIVE_TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">scheduled arrival time  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">MEAL  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">CHAR(1)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">indicator for type of meals available<BR CLEAR="LEFT">
B - Breakfast<BR CLEAR="LEFT">
L - Lunch<BR CLEAR="LEFT">
D - Dinner<BR CLEAR="LEFT">
S - Snack  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">FLYING_TIME  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">DOUBLE PRECISION  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">scheduled duration of flight  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">MILES  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">INTEGER  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">length of flight  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">AIRCRAFT  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(6)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">type of aircraft  </TD></TR>

	<TR>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;   </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">STATUS  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VARCHAR(20)  </TD>
		<TD ALIGN="LEFT" VALIGN="MIDDLE">&nbsp;  </TD>
		<TD ALIGN="LEFT" VALIGN="TOP">code indicating which trigger created the record  </TD></TR>

</TABLE>

<P><A NAME="TRIGGERS"></A>TRIGGERS: 

<UL>TRIG1 <BR CLEAR="LEFT">
</UL>


<UL><UL>after update on FLIGHTS <BR CLEAR="LEFT">
referencing old as UPDATEDROW <BR CLEAR="LEFT">
for each row <BR CLEAR="LEFT">
insert into FLIGHTS_HISTORY values ( <BR CLEAR="LEFT">
UPDATEDROW.FLIGHT_ID, <BR CLEAR="LEFT">
UPDATEDROW.SEGMENT_NUMBER, <BR CLEAR="LEFT">
UPDATEDROW.ORIG_AIRPORT, <BR CLEAR="LEFT">
UPDATEDROW.DEPART_TIME, <BR CLEAR="LEFT">
UPDATEDROW.DEST_AIRPORT, <BR CLEAR="LEFT">
UPDATEDROW.ARRIVE_TIME, <BR CLEAR="LEFT">
UPDATEDROW.MEAL, <BR CLEAR="LEFT">
UPDATEDROW.FLYING_TIME, <BR CLEAR="LEFT">
UPDATEDROW.MILES, <BR CLEAR="LEFT">
UPDATEDROW.AIRCRAFT, <BR CLEAR="LEFT">
'INSERTED FROM TRIG1'); </UL></UL>


<UL>TRIG2 <BR CLEAR="LEFT">
</UL>


<UL><UL>after delete on FLIGHTS <BR CLEAR="LEFT">
for each statement <BR CLEAR="LEFT">
insert into FLIGHTS_HISTORY (STATUS) values ('INSERTED FROM TRIG2'); 

</BODY>

</HTML>
